package com.ld.security.demo.event;

import com.ld.security.common.mybatis.base.vo.ProxyVo;
import com.ld.security.common.mybatis.event.QueryEvent;
import org.springframework.stereotype.Component;

@Component
public class SimpQueryEvent implements QueryEvent {

    @Override
    public void queryBefore(Object val) {
//        if(val instanceof SqlUserEntity){
//            SqlUserEntity sqlUserEntity = (SqlUserEntity)val;
//            sqlUserEntity.setCrtUser(LoginUtil.getUserId());
//
//        }
//
//        if(val instanceof SqlProjectPo){
//            SqlProjectPo sqlProjectPo= (SqlProjectPo)val;
//            String projectId =  ProjectUtil.getDefProectId();
//            sqlProjectPo.setProjectId(projectId);
//        }
    }

    @Override
    public void queryAfter(Object val) {

        if(val instanceof ProxyVo){
            ProxyVo proxyVo = (ProxyVo)val;
            proxyVo.queryAfter();
        }
    }

}
